package com.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.model.Severity;
import com.util.DataUtil;

public class SeverityDAO {
	
	public ArrayList<Severity> select(){
ArrayList<Severity> list = new ArrayList<Severity>();
		
		Connection conn = DataUtil.getConnection();
		try {
			CallableStatement stmt = conn.prepareCall("{ Call usp_dms_SeveritySelect }");
			ResultSet rs = DataUtil.executeStore(stmt);
			// Gets entities from resultset
			while (rs.next()) {
				Severity entity = new Severity(rs.getInt("Severity_Id"), 
										rs.getString("SeverityName"));
				list.add(entity);// add to list
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			DataUtil.disconnected();
		}
		return (list.isEmpty()) ? null : list;
	}
	
	public Severity select(int severityId){
		return null;
	}
}
